<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.css"/>
	<script type="text/javascript">
		function deleteById(id) {
			var isDelete = confirm("您确认要删除么？");
			if (isDelete) {
				location.href = "/JavaWeb1906/user?method=deleteById&id=" + id;
			}
		}
	</script>
</head>
<body>
	<%-- ${list} --%>
	<form action="/JavaWeb1906/user?method=search" method="post">
		名字：<input type="text" name="searchName"/>
		<input type="submit" value="搜索"/>
	</form>
	<!-- <a class="btn btn-success" href="/JavaWeb1906/user_add.jsp">添加</a> -->
	<a class="btn btn-success" href="/JavaWeb1906/user?method=getUserAddPage">添加</a>
	<table class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<th>学号</th>
			<th>姓名</th>
			<th>年龄</th>
			<th>性别</th>
			<th>部门ID</th>
			<th>删除</th>
			<th>修改</th>
		</tr>
		<c:forEach items="${list}" var="user">
			<tr>
				<td>${user.id}</td>
				<td>${user.name}</td>
				<td>${user.age}</td>
				<td>${user.gender}</td>
				<td>${user.deptId}</td>
				<%-- <td><a href="/JavaWeb1906/user?method=deleteById&id=${user.id}">删除</a></td> --%>
				<td><a href="javascript:void(0)" onclick="deleteById(${user.id})">删除</a></td>
				<td><a href="/JavaWeb1906/user?method=toUpdate&id=${user.id}">修改</a></td>
			</tr>
		</c:forEach>
	</table>
</body>
</html>